package cn.edu.sdjzu.xg.eagle.Service;

import cn.edu.sdjzu.xg.eagle.dao.SchoolDaoImpl;
import cn.edu.sdjzu.xg.eagle.entity.School;
import cn.edu.sdjzu.xg.eagle.util.JdbcHelper;

import java.sql.Connection;
import java.sql.SQLException;

public class SchoolService {

    // 获取schoolDao的实例
    private final SchoolDaoImpl schoolDao = SchoolDaoImpl.getInstance();

    //add()方法
    public boolean addSchool(School school) throws SQLException {
        Connection connection = null;
        try {
            //获取连接
            connection = JdbcHelper.getConn();
            //返回添加结果
            return schoolDao.addSchool(connection, school);
        } finally {
            JdbcHelper.close(connection);
        }

    }
}
